<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->id();
            $table->timestamps();//分类一般不动，可以选择去掉created_at和updated_at
            $table->string('name')->index()->comment('分类名称');
            $table->string('description')->nullable()->comment('分类说明');
            $table->unsignedInteger('topic_count')->default(0)->comment('该分类下帖子数量');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
};
